package com.qf.controller;/*
 *徐韬
 *2021/10/26
 *18:53
 */

import com.qf.dto.R;
import com.qf.dto.UserDto;
import com.qf.pojo.TAdminUser;
import com.qf.service.TAdminUserService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("/users")
@Api(tags = "用户信息管理")
class UserController {
            TAdminUserService tAdminUserService;
            @Autowired
            public void settAdminUserService(TAdminUserService tAdminUserService) {
                this.tAdminUserService = tAdminUserService;
            }
            @PostMapping ("/login")
            public R login(@RequestBody UserDto userDto, HttpSession session){
                TAdminUser user = tAdminUserService.login(userDto);
                System.out.println(userDto.toString());
                session.setAttribute("user", user);
                return R.setOk();

    }
}
